package com.ymatou.iapi.godmch.service;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ymatou.iapi.godmch.parameter.parentInfo;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.database.model.MarkupConfig;
import com.ymttest.utils.EnvSetup;
/**
*查询所有代理商加价配置Call
*FreeMaker Template自动生成代码
*/
public class GetAllAgentMarkupConfigCall extends YmatouBaseCall{
	private static String opurl ="api/agent/getAllAgentMarkupConfig";
	
	public GetAllAgentMarkupConfigCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
    public List<MarkupConfig> getList()
	{
    	List<MarkupConfig> list = null;
    	try {
    	  list = (List<MarkupConfig>) new Gson().fromJson(getJsonObject().get("result").getAsJsonObject().get("list").getAsJsonArray().toString(), new TypeToken<List<MarkupConfig>>() {}.getType());
    	} catch (Exception e) {
			e.printStackTrace();
		}
    	 return list;
    }
	
}